home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / Mac F2C 1.2.2 / Test Project ƒ / test.cp (C++ Output) < prev    next >
Encoding:
Text File  |  1995-03-22  |  18.3 KB  |  608 lines  |  [TEXT/KAHL]

  1. /* test.f -- translated by f2c (version 19941113).
  2.    You must link the resulting object file with the libraries:
  3.     -lf2c -lm   (in that order)
  4. */
  5.  
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #include "f2c.h"
  10.  
  11. /* Table of constant values */
  12.  
  13. static integer c__9 = 9;
  14. static integer c__1 = 1;
  15. static integer c__10 = 10;
  16. static integer c__3 = 3;
  17. static integer c__4 = 4;
  18. static integer c__5 = 5;
  19. static doublereal c_b168 = .33333333333333331;
  20.  
  21. /* Main program */ MAIN__()
  22. {
  23.     /* Format strings */
  24.     static char fmt_99[] = "(a1)";
  25.  
  26.     /* Builtin functions */
  27.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  28.         e_wsle(), s_rsfe(cilist *), do_fio(integer *, char *, ftnlen), 
  29.         e_rsfe();
  30.     /* Subroutine */ int s_stop(char *, ftnlen);
  31.  
  32.     /* Local variables */
  33.     char junk[2];
  34.     extern /* Subroutine */ int alg_test__(integer *), i_o_test__(), 
  35.         flt_test__(integer *), int_test__(integer *), trn_test__();
  36.  
  37.     /* Fortran I/O blocks */
  38.     static cilist io___1 = { 0, 6, 0, 0, 0 };
  39.     static cilist io___2 = { 0, 6, 0, 0, 0 };
  40.     static cilist io___3 = { 0, 5, 0, fmt_99, 0 };
  41.     static cilist io___5 = { 0, 6, 0, 0, 0 };
  42.     static cilist io___6 = { 0, 6, 0, 0, 0 };
  43.     static cilist io___7 = { 0, 5, 0, fmt_99, 0 };
  44.     static cilist io___8 = { 0, 6, 0, 0, 0 };
  45.     static cilist io___9 = { 0, 6, 0, 0, 0 };
  46.     static cilist io___10 = { 0, 5, 0, fmt_99, 0 };
  47.     static cilist io___11 = { 0, 6, 0, 0, 0 };
  48.     static cilist io___12 = { 0, 6, 0, 0, 0 };
  49.     static cilist io___13 = { 0, 5, 0, fmt_99, 0 };
  50.     static cilist io___14 = { 0, 6, 0, 0, 0 };
  51.     static cilist io___15 = { 0, 6, 0, 0, 0 };
  52.     static cilist io___16 = { 0, 5, 0, fmt_99, 0 };
  53.     static cilist io___17 = { 0, 6, 0, 0, 0 };
  54.     static cilist io___18 = { 0, 6, 0, 0, 0 };
  55.     static cilist io___19 = { 0, 6, 0, 0, 0 };
  56.     static cilist io___20 = { 0, 6, 0, 0, 0 };
  57.     static cilist io___21 = { 0, 6, 0, 0, 0 };
  58.  
  59.  
  60. /*     This is a FORTRAN program to test Mac F2C v1.1 */
  61.     s_wsle(&io___1);
  62.     do_lio(&c__9, &c__1, "*****   Input/Output Test   *****", 33L);
  63.     e_wsle();
  64.     i_o_test__();
  65.     s_wsle(&io___2);
  66.     do_lio(&c__9, &c__1, "\n*****   End of I/O test, hit return to continue.\
  67. ..", 51L);
  68.     e_wsle();
  69.     s_rsfe(&io___3);
  70.     do_fio(&c__1, junk, 2L);
  71.     e_rsfe();
  72.     s_wsle(&io___5);
  73.     do_lio(&c__9, &c__1, "\n*****   Integer Math Test   *****", 34L);
  74.     e_wsle();
  75.     int_test__(&c__10);
  76.     s_wsle(&io___6);
  77.     do_lio(&c__9, &c__1, "\n*****   End of integer math test, hit return to \
  78. continue...", 60L);
  79.     e_wsle();
  80.     s_rsfe(&io___7);
  81.     do_fio(&c__1, junk, 2L);
  82.     e_rsfe();
  83.     s_wsle(&io___8);
  84.     do_lio(&c__9, &c__1, "\n*****   Floating Point Math Test   *****", 41L);
  85.     e_wsle();
  86.     flt_test__(&c__10);
  87.     s_wsle(&io___9);
  88.     do_lio(&c__9, &c__1, "\n*****   End of floating point math test, hit ret\
  89. urn to continue...", 67L);
  90.     e_wsle();
  91.     s_rsfe(&io___10);
  92.     do_fio(&c__1, junk, 2L);
  93.     e_rsfe();
  94.     s_wsle(&io___11);
  95.     do_lio(&c__9, &c__1, "\n*****   Algebraic Function Test   *****", 40L);
  96.     e_wsle();
  97.     alg_test__(&c__10);
  98.     s_wsle(&io___12);
  99.     do_lio(&c__9, &c__1, "\n*****   End of algebraic function test, hit retu\
  100. rn to continue...", 66L);
  101.     e_wsle();
  102.     s_rsfe(&io___13);
  103.     do_fio(&c__1, junk, 2L);
  104.     e_rsfe();
  105.     s_wsle(&io___14);
  106.     do_lio(&c__9, &c__1, "\n*****   Transcendental Function Test   *****", 
  107.         45L);
  108.     e_wsle();
  109.     trn_test__();
  110.     s_wsle(&io___15);
  111.     do_lio(&c__9, &c__1, "\n*****   End of transcendental function test, hit\
  112.  return to continue...", 71L);
  113.     e_wsle();
  114.     s_rsfe(&io___16);
  115.     do_fio(&c__1, junk, 2L);
  116.     e_rsfe();
  117.     s_wsle(&io___17);
  118.     do_lio(&c__9, &c__1, "##################################################\
  119. ########################", 74L);
  120.     e_wsle();
  121.     s_wsle(&io___18);
  122.     do_lio(&c__9, &c__1, " If you noticed that floating point values did not\
  123.  round correctly when", 71L);
  124.     e_wsle();
  125.     s_wsle(&io___19);
  126.     do_lio(&c__9, &c__1, " displayed, please read the enclosed file \"If Flo\
  127. ats Don't Display Right\"", 73L);
  128.     e_wsle();
  129.     s_wsle(&io___20);
  130.     do_lio(&c__9, &c__1, "##################################################\
  131. ########################", 74L);
  132.     e_wsle();
  133.     s_wsle(&io___21);
  134.     do_lio(&c__9, &c__1, "\n*****   This completes all of the tests   *****", 
  135.         48L);
  136.     e_wsle();
  137.     s_stop("", 0L);
  138.     return 0;
  139. } /* MAIN__ */
  140.  
  141. /**************************************************************************/
  142.  
  143. /*     Subroutine to do the I/O tests */
  144.  
  145. /**************************************************************************/
  146. /* Subroutine */ int i_o_test__()
  147. {
  148.     /* Format strings */
  149.     static char fmt_399[] = "(a1)";
  150.     static char fmt_304[] = "(5x,a20,5(i1,2x),5x,5(f4.2,2x))";
  151.  
  152.     /* System generated locals */
  153.     olist o__1;
  154.     cllist cl__1;
  155.  
  156.     /* Builtin functions */
  157.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  158.         e_wsle(), s_rsle(cilist *), e_rsle(), s_rsfe(cilist *), do_fio(
  159.         integer *, char *, ftnlen), e_rsfe();
  160.     void s_copy(char *, char *, ftnlen, ftnlen);
  161.     integer f_open(olist *), s_wsue(cilist *), do_uio(integer *, char *, 
  162.         ftnlen), e_wsue(), f_clos(cllist *), s_wsfe(cilist *), e_wsfe(), 
  163.         s_rsue(cilist *), e_rsue();
  164.  
  165.     /* Local variables */
  166.     char text[40];
  167.     real a[5];
  168.     integer i, j[5];
  169.     real x;
  170.     doublereal dx;
  171.  
  172.     /* Fortran I/O blocks */
  173.     static cilist io___22 = { 0, 6, 0, 0, 0 };
  174.     static cilist io___23 = { 0, 5, 0, 0, 0 };
  175.     static cilist io___25 = { 0, 6, 0, 0, 0 };
  176.     static cilist io___26 = { 0, 6, 0, 0, 0 };
  177.     static cilist io___27 = { 0, 5, 0, 0, 0 };
  178.     static cilist io___29 = { 0, 6, 0, 0, 0 };
  179.     static cilist io___30 = { 0, 6, 0, 0, 0 };
  180.     static cilist io___31 = { 0, 5, 0, 0, 0 };
  181.     static cilist io___33 = { 0, 6, 0, 0, 0 };
  182.     static cilist io___34 = { 0, 6, 0, 0, 0 };
  183.     static cilist io___35 = { 0, 5, 0, 0, 0 };
  184.     static cilist io___37 = { 0, 6, 0, 0, 0 };
  185.     static cilist io___38 = { 0, 6, 0, 0, 0 };
  186.     static cilist io___39 = { 0, 5, 0, fmt_399, 0 };
  187.     static cilist io___42 = { 0, 60, 0, 0, 0 };
  188.     static cilist io___43 = { 0, 6, 0, 0, 0 };
  189.     static cilist io___44 = { 0, 6, 0, fmt_304, 0 };
  190.     static cilist io___45 = { 0, 50, 0, 0, 0 };
  191.     static cilist io___46 = { 0, 6, 0, 0, 0 };
  192.     static cilist io___47 = { 0, 6, 0, fmt_304, 0 };
  193.  
  194.  
  195. /*     Screen I/O tests */
  196.     s_wsle(&io___22);
  197.     do_lio(&c__9, &c__1, "\nPart 1:  Screen I/O tests.\n\nEnter an integer v\
  198. alue.", 52L);
  199.     e_wsle();
  200.     s_rsle(&io___23);
  201.     do_lio(&c__3, &c__1, (char *)&i, (ftnlen)sizeof(integer));
  202.     e_rsle();
  203.     s_wsle(&io___25);
  204.     do_lio(&c__9, &c__1, "The number you entered was:", 27L);
  205.     do_lio(&c__3, &c__1, (char *)&i, (ftnlen)sizeof(integer));
  206.     e_wsle();
  207.     s_wsle(&io___26);
  208.     do_lio(&c__9, &c__1, "\nEnter a single precision floating point value...",
  209.          49L);
  210.     e_wsle();
  211.     s_rsle(&io___27);
  212.     do_lio(&c__4, &c__1, (char *)&x, (ftnlen)sizeof(real));
  213.     e_rsle();
  214.     s_wsle(&io___29);
  215.     do_lio(&c__9, &c__1, "The number you entered was: ", 28L);
  216.     do_lio(&c__4, &c__1, (char *)&x, (ftnlen)sizeof(real));
  217.     e_wsle();
  218.     s_wsle(&io___30);
  219.     do_lio(&c__9, &c__1, "\nEnter a double precision floating point value...",
  220.          49L);
  221.     e_wsle();
  222.     s_rsle(&io___31);
  223.     do_lio(&c__5, &c__1, (char *)&dx, (ftnlen)sizeof(doublereal));
  224.     e_rsle();
  225.     s_wsle(&io___33);
  226.     do_lio(&c__9, &c__1, "The number you entered was: ", 28L);
  227.     do_lio(&c__5, &c__1, (char *)&dx, (ftnlen)sizeof(doublereal));
  228.     e_wsle();
  229.     s_wsle(&io___34);
  230.     do_lio(&c__9, &c__1, "\nEnter some text (40 char max)...", 33L);
  231.     e_wsle();
  232.     s_rsle(&io___35);
  233.     do_lio(&c__9, &c__1, text, 40L);
  234.     e_rsle();
  235.     s_wsle(&io___37);
  236.     do_lio(&c__9, &c__1, "The text you entered was: ", 26L);
  237.     do_lio(&c__9, &c__1, text, 40L);
  238.     e_wsle();
  239.     s_wsle(&io___38);
  240.     do_lio(&c__9, &c__1, "\nPart 2:  file I/O tests.  Hit return to continue\
  241. ...", 52L);
  242.     e_wsle();
  243.     s_rsfe(&io___39);
  244.     do_fio(&c__1, text, 40L);
  245.     e_rsfe();
  246. /*     File I/O tests:  Store some values and write them to file */
  247.     for (i = 1; i <= 5; ++i) {
  248.     j[i - 1] = i;
  249.     a[i - 1] = (doublereal) i;
  250.     }
  251.     s_copy(text, "A test message.", 40L, 15L);
  252.     o__1.oerr = 0;
  253.     o__1.ounit = 60;
  254.     o__1.ofnmlen = 8;
  255.     o__1.ofnm = "test.dat";
  256.     o__1.orl = 0;
  257.     o__1.osta = 0;
  258.     o__1.oacc = 0;
  259.     o__1.ofm = "unformatted";
  260.     o__1.oblnk = 0;
  261.     f_open(&o__1);
  262.     s_wsue(&io___42);
  263.     do_uio(&c__1, text, 40L);
  264.     do_uio(&c__5, (char *)&j[0], (ftnlen)sizeof(integer));
  265.     do_uio(&c__5, (char *)&a[0], (ftnlen)sizeof(real));
  266.     e_wsue();
  267.     cl__1.cerr = 0;
  268.     cl__1.cunit = 60;
  269.     cl__1.csta = 0;
  270.     f_clos(&cl__1);
  271.     s_wsle(&io___43);
  272.     do_lio(&c__9, &c__1, "Wrote the following data to file test.dat:\n", 43L);
  273.     e_wsle();
  274.     s_wsfe(&io___44);
  275.     do_fio(&c__1, text, 40L);
  276.     for (i = 1; i <= 5; ++i) {
  277.     do_fio(&c__1, (char *)&j[i - 1], (ftnlen)sizeof(integer));
  278.     }
  279.     for (i = 1; i <= 5; ++i) {
  280.     do_fio(&c__1, (char *)&a[i - 1], (ftnlen)sizeof(real));
  281.     }
  282.     e_wsfe();
  283. /* Reset the variables and read them back */
  284.     for (i = 1; i <= 5; ++i) {
  285.     j[i - 1] = 99;
  286.     a[i - 1] = (float)99.;
  287.     }
  288.     s_copy(text, "reset", 40L, 5L);
  289.     o__1.oerr = 0;
  290.     o__1.ounit = 50;
  291.     o__1.ofnmlen = 8;
  292.     o__1.ofnm = "test.dat";
  293.     o__1.orl = 0;
  294.     o__1.osta = 0;
  295.     o__1.oacc = 0;
  296.     o__1.ofm = "unformatted";
  297.     o__1.oblnk = 0;
  298.     f_open(&o__1);
  299.     s_rsue(&io___45);
  300.     do_uio(&c__1, text, 40L);
  301.     do_uio(&c__5, (char *)&j[0], (ftnlen)sizeof(integer));
  302.     do_uio(&c__5, (char *)&a[0], (ftnlen)sizeof(real));
  303.     e_rsue();
  304.     cl__1.cerr = 0;
  305.     cl__1.cunit = 50;
  306.     cl__1.csta = 0;
  307.     f_clos(&cl__1);
  308.     s_wsle(&io___46);
  309.     do_lio(&c__9, &c__1, "\nRead the following data from file test.dat:\n", 
  310.         45L);
  311.     e_wsle();
  312.     s_wsfe(&io___47);
  313.     do_fio(&c__1, text, 40L);
  314.     for (i = 1; i <= 5; ++i) {
  315.     do_fio(&c__1, (char *)&j[i - 1], (ftnlen)sizeof(integer));
  316.     }
  317.     for (i = 1; i <= 5; ++i) {
  318.     do_fio(&c__1, (char *)&a[i - 1], (ftnlen)sizeof(real));
  319.     }
  320.     e_wsfe();
  321.     return 0;
  322. } /* i_o_test__ */
  323.  
  324. /**************************************************************************/
  325.  
  326. /*     Subroutine to do the integer math tests */
  327.  
  328. /**************************************************************************/
  329. /* Subroutine */ int int_test__(integer *m)
  330. {
  331.     /* Format strings */
  332.     static char fmt_203[] = "(10x,\002n\002,5x,\002n^2\002,5x,\002n^3\002,\
  333. 5x,\002n/2\002,3x,\002n^2/2\002,3x,\002n^3/2\002)";
  334.     static char fmt_202[] = "(5x,6(i6,2x))";
  335.  
  336.     /* System generated locals */
  337.     integer i__1, i__2, i__3, i__4;
  338.  
  339.     /* Builtin functions */
  340.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  341.         e_wsle(), s_wsfe(cilist *), e_wsfe(), do_fio(integer *, char *, 
  342.         ftnlen);
  343.  
  344.     /* Local variables */
  345.     integer i, j, k;
  346.  
  347.     /* Fortran I/O blocks */
  348.     static cilist io___48 = { 0, 6, 0, 0, 0 };
  349.     static cilist io___49 = { 0, 6, 0, fmt_203, 0 };
  350.     static cilist io___53 = { 0, 6, 0, fmt_202, 0 };
  351.  
  352.  
  353.     s_wsle(&io___48);
  354.     do_lio(&c__9, &c__1, "\nGenerate a table of integers, squares, cubes, an\
  355. d their halves.\n", 65L);
  356.     e_wsle();
  357.     s_wsfe(&io___49);
  358.     e_wsfe();
  359.     i__1 = *m;
  360.     for (i = 1; i <= i__1; ++i) {
  361. /* Computing 2nd power */
  362.     i__2 = i;
  363.     j = i__2 * i__2;
  364. /* Computing 3rd power */
  365.     i__2 = i, i__3 = i__2;
  366.     k = i__3 * (i__2 * i__2);
  367.     s_wsfe(&io___53);
  368.     do_fio(&c__1, (char *)&i, (ftnlen)sizeof(integer));
  369.     do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
  370.     do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer));
  371.     i__2 = i / 2;
  372.     do_fio(&c__1, (char *)&i__2, (ftnlen)sizeof(integer));
  373.     i__3 = j / 2;
  374.     do_fio(&c__1, (char *)&i__3, (ftnlen)sizeof(integer));
  375.     i__4 = k / 2;
  376.     do_fio(&c__1, (char *)&i__4, (ftnlen)sizeof(integer));
  377.     e_wsfe();
  378.     }
  379.     return 0;
  380. } /* int_test__ */
  381.  
  382. /**************************************************************************/
  383.  
  384. /*     Subroutine to do the floating point math tests */
  385.  
  386. /**************************************************************************/
  387. /* Subroutine */ int flt_test__(integer *m)
  388. {
  389.     /* Format strings */
  390.     static char fmt_205[] = "(12x,\002x\002,6x,\002x^2\002,6x,\002x^3\002,\
  391. 6x,\002x/2\002,4x,\002x^2/2\002,4x,\002x^3/2\002)";
  392.     static char fmt_201[] = "(5x,6(f8.2,1x))";
  393.  
  394.     /* System generated locals */
  395.     integer i__1;
  396.     real r__1, r__2, r__3;
  397.  
  398.     /* Builtin functions */
  399.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  400.         e_wsle(), s_wsfe(cilist *), e_wsfe(), do_fio(integer *, char *, 
  401.         ftnlen);
  402.  
  403.     /* Local variables */
  404.     integer i;
  405.     real x1, x2, x3;
  406.  
  407.     /* Fortran I/O blocks */
  408.     static cilist io___54 = { 0, 6, 0, 0, 0 };
  409.     static cilist io___55 = { 0, 6, 0, fmt_205, 0 };
  410.     static cilist io___60 = { 0, 6, 0, fmt_201, 0 };
  411.  
  412.  
  413.     s_wsle(&io___54);
  414.     do_lio(&c__9, &c__1, "\nGenerate a table of floats, their squares, cubes\
  415. , and their halves.\n", 69L);
  416.     e_wsle();
  417.     s_wsfe(&io___55);
  418.     e_wsfe();
  419.     i__1 = *m;
  420.     for (i = 1; i <= i__1; ++i) {
  421.     x1 = i * (float)1.;
  422. /* Computing 2nd power */
  423.     r__1 = x1;
  424.     x2 = r__1 * r__1;
  425. /* Computing 3rd power */
  426.     r__1 = x1, r__2 = r__1;
  427.     x3 = r__2 * (r__1 * r__1);
  428.     s_wsfe(&io___60);
  429.     do_fio(&c__1, (char *)&x1, (ftnlen)sizeof(real));
  430.     do_fio(&c__1, (char *)&x2, (ftnlen)sizeof(real));
  431.     do_fio(&c__1, (char *)&x3, (ftnlen)sizeof(real));
  432.     r__1 = x1 / 2;
  433.     do_fio(&c__1, (char *)&r__1, (ftnlen)sizeof(real));
  434.     r__2 = x2 / 2;
  435.     do_fio(&c__1, (char *)&r__2, (ftnlen)sizeof(real));
  436.     r__3 = x3 / 2;
  437.     do_fio(&c__1, (char *)&r__3, (ftnlen)sizeof(real));
  438.     e_wsfe();
  439.     }
  440.     return 0;
  441. } /* flt_test__ */
  442.  
  443. /**************************************************************************/
  444.  
  445. /*     Subroutine to do the algebraic function tests */
  446.  
  447. /**************************************************************************/
  448. /* Subroutine */ int alg_test__(integer *m)
  449. {
  450.     /* Format strings */
  451.     static char fmt_305[] = "(10x,\002x\002,7x,\002SQRT(x)\002,4x,\002CURT\
  452. (x)\002,3x,\002SQRT(x)^2\002,2x,\002CURT(x)^3\002)";
  453.     static char fmt_301[] = "(5x,6(f9.6,2x))";
  454.  
  455.     /* System generated locals */
  456.     integer i__1;
  457.     real r__1, r__2, r__3, r__4, r__5;
  458.     doublereal d__1;
  459.  
  460.     /* Builtin functions */
  461.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  462.         e_wsle(), s_wsfe(cilist *), e_wsfe();
  463.     double sqrt(doublereal), pow_dd(doublereal *, doublereal *);
  464.     integer do_fio(integer *, char *, ftnlen);
  465.  
  466.     /* Local variables */
  467.     integer i;
  468.     real x1, x2, x3;
  469.  
  470.     /* Fortran I/O blocks */
  471.     static cilist io___61 = { 0, 6, 0, 0, 0 };
  472.     static cilist io___62 = { 0, 6, 0, fmt_305, 0 };
  473.     static cilist io___67 = { 0, 6, 0, fmt_301, 0 };
  474.  
  475.  
  476.     s_wsle(&io___61);
  477.     do_lio(&c__9, &c__1, "\nGenerate a table of floats, square & cube roots,\
  478.  and their squares & cubes.\n", 77L);
  479.     e_wsle();
  480.     s_wsfe(&io___62);
  481.     e_wsfe();
  482.     i__1 = *m;
  483.     for (i = 1; i <= i__1; ++i) {
  484.     x1 = i * (float)1.;
  485.     x2 = sqrt(x1);
  486.     d__1 = (doublereal) x1;
  487.     x3 = pow_dd(&d__1, &c_b168);
  488.     s_wsfe(&io___67);
  489.     do_fio(&c__1, (char *)&x1, (ftnlen)sizeof(real));
  490.     do_fio(&c__1, (char *)&x2, (ftnlen)sizeof(real));
  491.     do_fio(&c__1, (char *)&x3, (ftnlen)sizeof(real));
  492. /* Computing 2nd power */
  493.     r__2 = x2;
  494.     r__1 = r__2 * r__2;
  495.     do_fio(&c__1, (char *)&r__1, (ftnlen)sizeof(real));
  496. /* Computing 3rd power */
  497.     r__4 = x3, r__5 = r__4;
  498.     r__3 = r__5 * (r__4 * r__4);
  499.     do_fio(&c__1, (char *)&r__3, (ftnlen)sizeof(real));
  500.     e_wsfe();
  501.     }
  502.     return 0;
  503. } /* alg_test__ */
  504.  
  505. /**************************************************************************/
  506.  
  507. /*     Subroutine to do the transcendental function tests */
  508.  
  509. /**************************************************************************/
  510. /* Subroutine */ int trn_test__()
  511. {
  512.     /* Format strings */
  513.     static char fmt_207[] = "(9x,\002x\002,9x,\002sin(x)\002,8x,\002cos(x\
  514. )\002,4x,\002sin(x)^2 + cos(x)^2\002)";
  515.     static char fmt_200[] = "(5x,i2,\002*pi/6\0023x,f11.8,3x,f11.8,3x,f15.10)"
  516.         ;
  517.     static char fmt_299[] = "(a1)";
  518.     static char fmt_208[] = "(11x,\002x\002,16x,\002log(x)\002,9x,\002exp(lo\
  519. g(x))\002)";
  520.     static char fmt_201[] = "(5x,f13.10,5x,f13.10,5x,f13.10)";
  521.  
  522.     /* System generated locals */
  523.     doublereal d__1;
  524.  
  525.     /* Builtin functions */
  526.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  527.         e_wsle(), s_wsfe(cilist *), e_wsfe();
  528.     double sin(doublereal), cos(doublereal);
  529.     integer do_fio(integer *, char *, ftnlen), s_rsfe(cilist *), e_rsfe();
  530.     double log(doublereal), exp(doublereal);
  531.  
  532.     /* Local variables */
  533.     char junk[2];
  534.     doublereal c;
  535.     integer i;
  536.     doublereal s, x, c2, s2, pi;
  537.  
  538.     /* Fortran I/O blocks */
  539.     static cilist io___69 = { 0, 6, 0, 0, 0 };
  540.     static cilist io___70 = { 0, 6, 0, 0, 0 };
  541.     static cilist io___71 = { 0, 6, 0, fmt_207, 0 };
  542.     static cilist io___78 = { 0, 6, 0, fmt_200, 0 };
  543.     static cilist io___79 = { 0, 6, 0, 0, 0 };
  544.     static cilist io___80 = { 0, 5, 0, fmt_299, 0 };
  545.     static cilist io___82 = { 0, 6, 0, 0, 0 };
  546.     static cilist io___83 = { 0, 6, 0, fmt_208, 0 };
  547.     static cilist io___84 = { 0, 6, 0, fmt_201, 0 };
  548.  
  549.  
  550.     pi = (float)3.141592653589793;
  551.     s_wsle(&io___69);
  552.     do_lio(&c__9, &c__1, "\nPart 1: Trig Functions", 23L);
  553.     e_wsle();
  554.     s_wsle(&io___70);
  555.     do_lio(&c__9, &c__1, "\nGenerate a table of x, sin(x), cos(x) and the su\
  556. m of their squares.\n", 69L);
  557.     e_wsle();
  558.     s_wsfe(&io___71);
  559.     e_wsfe();
  560.     for (i = 1; i <= 12; ++i) {
  561.     x = i * pi / (float)6.;
  562.     s = sin(x);
  563.     c = cos(x);
  564. /* Computing 2nd power */
  565.     d__1 = s;
  566.     s2 = d__1 * d__1;
  567. /* Computing 2nd power */
  568.     d__1 = c;
  569.     c2 = d__1 * d__1;
  570.     s_wsfe(&io___78);
  571.     do_fio(&c__1, (char *)&i, (ftnlen)sizeof(integer));
  572.     do_fio(&c__1, (char *)&s, (ftnlen)sizeof(doublereal));
  573.     do_fio(&c__1, (char *)&c, (ftnlen)sizeof(doublereal));
  574.     d__1 = s2 + c2;
  575.     do_fio(&c__1, (char *)&d__1, (ftnlen)sizeof(doublereal));
  576.     e_wsfe();
  577.     }
  578.     s_wsle(&io___79);
  579.     do_lio(&c__9, &c__1, "\nPart 2:  Exponential functions; hit return to co\
  580. ntinue...", 58L);
  581.     e_wsle();
  582.     s_rsfe(&io___80);
  583.     do_fio(&c__1, junk, 2L);
  584.     e_rsfe();
  585.     s_wsle(&io___82);
  586.     do_lio(&c__9, &c__1, "Generate a table of x, log(x), and exp(log(x))\n", 
  587.         47L);
  588.     e_wsle();
  589.     s_wsfe(&io___83);
  590.     e_wsfe();
  591.     for (i = 1; i <= 10; ++i) {
  592.     x = (doublereal) i;
  593.     s = log(x);
  594.     c = exp(s);
  595.     s_wsfe(&io___84);
  596.     do_fio(&c__1, (char *)&x, (ftnlen)sizeof(doublereal));
  597.     do_fio(&c__1, (char *)&s, (ftnlen)sizeof(doublereal));
  598.     do_fio(&c__1, (char *)&c, (ftnlen)sizeof(doublereal));
  599.     e_wsfe();
  600.     }
  601.     return 0;
  602. } /* trn_test__ */
  603.  
  604. /* Main program alias */ int test_f2c__ () { MAIN__ (); return 0; }
  605. #ifdef __cplusplus
  606.     }
  607. #endif
  608.